import type { RouteRecordRaw } from 'vue-router'
// 扩展 RouteMeta 接口
declare module 'vue-router' {
  interface RouteMeta {
    isLink?: string
    isHide?: boolean
    isAuth?: boolean
    isKeepAlive?: boolean
    isAffix?: boolean
    isIframe?: boolean
    roles?: string[]
    icon?: string
  }
}

/**
 * 定义静态路由（默认路由）
 * 前端添加路由，请在此处加
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/login.vue'),
    meta: {
      isAuth: false,
    },
  },
]

/**
 * 定义404、401界面
 */
export const notFoundAndNoPower: Array<RouteRecordRaw> = [
  {
    path: '/:path(.*)*',
    name: 'staticRoutes.notFound',
    component: () => import('@/views/error/404.vue'),
    meta: {
      isHide: true,
    },
  },
  {
    path: '/401',
    name: 'staticRoutes.noPower',
    component: () => import('@/views/error/401.vue'),
    meta: {
      isHide: true,
    },
  },
]

/**
 *  基础性路由
 *
 * 所有节点都是挂载此节点下
 */
export const baseRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: '/',
    component: () => import('@/library/layouts/index.vue'),
    redirect: '/home',
    meta: {
      isKeepAlive: true,
    },
    children: [],
  },
]
